home *** CD-ROM | disk | FTP | other *** search
- var iAttachyY = 0;
- var iAttachyH = 0;
- var oAttachy = null;
- var iScrollMax = 0;
- var iScrollVal = 0;
- var iScrollSmooth = 0;
- var iScrollBGH = oScrollBG._height;
- var bScrolling = false;
- var iOBarHeight = oScrollSlider._height;
- var oDummyScroller = new Object();
- oScrollSlider._visible = false;
- oScrollSlider.onPress = function()
- {
- bScrolling = true;
- this.startDrag(0,0,-1,0,iScrollBGH - iOBarHeight);
- };
- oScrollSlider.onRelease = function()
- {
- this.stopDrag();
- bScrolling = false;
- };
- oScrollSlider.onReleaseOutside = function()
- {
- this.onRelease();
- };
- this.onMouseWheel = function(mVal)
- {
- var _loc1_ = false;
- if(oScrollSlider._y > 0)
- {
- _loc1_ = true;
- }
- else
- {
- oScrollSlider._y = 0;
- _loc1_ = false;
- }
- if(oScrollSlider._y < iScrollBGH - iOBarHeight)
- {
- _loc1_ = true;
- }
- else
- {
- oScrollSlider._y = iScrollBGH - iOBarHeight;
- _loc1_ = false;
- }
- if(_loc1_)
- {
- oScrollSlider._y -= mVal / 3;
- bScrolling = true;
- }
- };
- Mouse.addListener(this);
- setScrollBar = function(oScrollAttach, iOrig, iMax)
- {
- oAttachy = oScrollAttach;
- iScrollMax = iMax;
- iAttachyH = iOrig;
- if(iScrollMax > iAttachyH)
- {
- oScrollSlider._visible = true;
- iOBarHeight = Math.ceil(iScrollBGH / 100 * (iAttachyH / iScrollMax * 100));
- if(iOBarHeight >= 3)
- {
- oScrollSlider._height = iOBarHeight;
- }
- else
- {
- oScrollSlider._height = 3;
- }
- }
- else
- {
- oScrollSlider._visible = false;
- }
- oDummyScroller._y = oScrollSlider._y;
- };
- this.onEnterFrame = function()
- {
- iScrollSmooth = (oDummyScroller._y - oScrollSlider._y) * 0.5;
- if(iScrollMax > iAttachyH)
- {
- oDummyScroller._y -= iScrollSmooth;
- iScrollVal = Math.round(oDummyScroller._y / (iScrollBGH - iOBarHeight) * 100);
- oAttachy._y = iAttachyY - (iScrollMax - iAttachyH) / 100 * iScrollVal;
- oAttachy.oMask._y = iAttachyY - oAttachy._y;
- }
- };
-